<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <!-- hexo-inject:begin --><!-- hexo-inject:end --><meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 5.1.1">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-zhao.jpg">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-zhao.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-zhao.png">
  <link rel="mask-icon" href="/images/logo-zhao.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">


<link rel="stylesheet" href="/lib/font-awesome/css/all.min.css">

<script id="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"zjybjea.cn","root":"/","scheme":"Gemini","version":"7.8.0","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":true,"show_result":false,"style":null},"back2top":{"enable":true,"sidebar":false,"scrollpercent":false},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},"path":"search.xml"};
  </script>

  <meta name="description" content="比赛链接第一题：Cow Gymnastics 题目： In order to improve their physical fitness, the cows have taken up gymnastics! Farmer John designates his favorite cow Bessie to coach the N other cows and to assess their p">
<meta property="og:type" content="article">
<meta property="og:title" content="USACO 2019 December Contest, Bronze">
<meta property="og:url" content="http://zjybjea.cn/2019/12/20/USACO-2019-December-Contest-Bronze/index.html">
<meta property="og:site_name" content="赵嘉熠的博客">
<meta property="og:description" content="比赛链接第一题：Cow Gymnastics 题目： In order to improve their physical fitness, the cows have taken up gymnastics! Farmer John designates his favorite cow Bessie to coach the N other cows and to assess their p">
<meta property="og:locale" content="zh_CN">
<meta property="article:published_time" content="2019-12-20T03:35:42.000Z">
<meta property="article:modified_time" content="2020-10-10T12:30:46.751Z">
<meta property="article:author" content="Zhao Jiayi">
<meta property="article:tag" content="信息学">
<meta name="twitter:card" content="summary">

<link rel="canonical" href="http://zjybjea.cn/2019/12/20/USACO-2019-December-Contest-Bronze/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : false,
    isPost : true,
    lang   : 'zh-CN'
  };
</script>

  <title>USACO 2019 December Contest, Bronze | 赵嘉熠的博客</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript><!-- hexo-inject:begin --><!-- hexo-inject:end -->

</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <!-- hexo-inject:begin --><!-- hexo-inject:end --><div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <h1 class="site-title">赵嘉熠的博客</h1>
      <span class="logo-line-after"><i></i></span>
    </a>
      <p class="site-subtitle" itemprop="description">ZJY'S BLOG</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>




<nav class="site-nav">
  <ul id="menu" class="main-menu menu">
        <li class="menu-item menu-item-home">

    <a href="/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a>

  </li>
        <li class="menu-item menu-item-about">

    <a href="/about/" rel="section"><i class="fa fa-user fa-fw"></i>关于</a>

  </li>
        <li class="menu-item menu-item-tags">

    <a href="/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>标签</a>

  </li>
        <li class="menu-item menu-item-categories">

    <a href="/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类</a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档</a>

  </li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup">
        <div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocapitalize="off"
           placeholder="搜索..." spellcheck="false"
           type="search" class="search-input">
  </div>
  <span class="popup-btn-close">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div id="search-result">
  <div id="no-result">
    <i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i>
  </div>
</div>

    </div>
  </div>

</div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content post posts-expand">
            

    
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="http://zjybjea.cn/2019/12/20/USACO-2019-December-Contest-Bronze/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/doggy.jpg">
      <meta itemprop="name" content="Zhao Jiayi">
      <meta itemprop="description" content="">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="赵嘉熠的博客">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          USACO 2019 December Contest, Bronze
        </h1>

        <div class="post-meta">
        	
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2019-12-20 11:35:42" itemprop="dateCreated datePublished" datetime="2019-12-20T11:35:42+08:00">2019-12-20</time>
            </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-folder"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/%E4%BF%A1%E6%81%AF%E5%AD%A6/" itemprop="url" rel="index"><span itemprop="name">信息学</span></a>
                </span>
            </span>

          
  
  <span class="post-meta-item">
    
      <span class="post-meta-item-icon">
        <i class="far fa-comment"></i>
      </span>
      <span class="post-meta-item-text">Valine：</span>
    
    <a title="valine" href="/2019/12/20/USACO-2019-December-Contest-Bronze/#valine-comments" itemprop="discussionUrl">
      <span class="post-comments-count valine-comment-count" data-xid="/2019/12/20/USACO-2019-December-Contest-Bronze/" itemprop="commentCount"></span>
    </a>
  </span>
  
  

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <h3 id="比赛链接"><a href="#比赛链接" class="headerlink" title="比赛链接"></a><a target="_blank" rel="noopener" href="http://usaco.org/index.php?page=dec19results"><strong>比赛链接</strong></a></h3><h3 id="第一题："><a href="#第一题：" class="headerlink" title="第一题："></a><strong>第一题：</strong></h3><p><a target="_blank" rel="noopener" href="http://usaco.org/index.php?page=viewproblem2&amp;cpid=963">Cow Gymnastics</a></p>
<p><strong>题目：</strong></p>
<p>In order to improve their physical fitness, the cows have taken up gymnastics! Farmer John designates his favorite cow Bessie to coach the N other cows and to assess their progress as they learn various gymnastic skills.<br>In each of K practice sessions (1≤K≤10), Bessie ranks the N cows according to their performance (1≤N≤20). Afterward, she is curious about the consistency in these rankings. A pair of two distinct cows is consistent if one cow did better than the other one in every practice session.</p>
<a id="more"></a>
<p>Help Bessie compute the total number of consistent pairs.</p>
<p>INPUT FORMAT (file gymnastics.in):<br>The first line of the input file contains two positive integers K and N. The next K lines will each contain the integers 1…N in some order, indicating the rankings of the cows (cows are identified by the numbers 1…N). If A appears before B in one of these lines, that means cow A did better than cow B.</p>
<p><strong>翻译</strong>：</p>
<p>为了提高健康水平，奶牛们开始进行体操训练了！Farmer John 选定了他最喜爱的奶牛 Bessie 来执教其他 N 头奶牛，同时评估她们学习不同的体操技术的进度。<br>K 次训练课的每一次（1≤K≤10），Bessie 都会根据 N 头奶牛的表现给她们进行排名（1≤N≤20）。之后，她对这些排名的一致性产生了好奇。称一对不同的奶牛是一致的，如果其中一头奶牛在每次训练课中都表现得都比另一头要好。</p>
<p>请帮助 Bessie 计算一致的奶牛的对数。</p>
<p><strong>输入格式（文件名：gymnastics.in）：</strong></p>
<p>输入的第一行包含两个正整数 K 和 N。以下 K 行每行包含整数 1…N 的某种排列，表示奶牛们的排名（奶牛们用编号 1…N 进行区分）。如果在某一行中 A 出现在 B 之前，表示奶牛 A 表现得比奶牛 B 要好。</p>
<p><strong>输入格式（文件名：gymnastics.in）：</strong></p>
<p>输入的第一行包含两个正整数 K 和 N。以下 K 行每行包含整数 1…N 的某种排列，表示奶牛们的排名（奶牛们用编号 1…N 进行区分）。如果在某一行中 A 出现在 B 之前，表示奶牛 A 表现得比奶牛 B 要好。</p>
<p><strong>输出格式（文件名：gymnastics.out）：</strong></p>
<p>输出一行，包含一致的奶牛的对数。</p>
<p><strong>输入样例：</strong></p>
<p>3 4<br>4 1 2 3<br>4 1 3 2<br>4 2 1 3  </p>
<p><strong>输出样例：</strong></p>
<p>4</p>
<p>一致的奶牛对为 (1,4)、(2,4)、(3,4) 和 (1,3).</p>
<p><strong>代码：</strong></p>
<figure class="highlight cpp"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/*</span></span><br><span class="line"><span class="comment">ID: zhaojiayi</span></span><br><span class="line"><span class="comment">TASK: Cow Gymnastics</span></span><br><span class="line"><span class="comment">LANG: C++</span></span><br><span class="line"><span class="comment">*/</span></span><br><span class="line"><span class="meta">#<span class="meta-keyword">include</span><span class="meta-string">&lt;bits/stdc++.h&gt;</span></span></span><br><span class="line"><span class="keyword">using</span> <span class="keyword">namespace</span> <span class="built_in">std</span>;</span><br><span class="line"><span class="keyword">int</span> n,k;</span><br><span class="line"><span class="keyword">int</span> a[<span class="number">25</span>][<span class="number">15</span>];</span><br><span class="line"><span class="keyword">int</span> ans;</span><br><span class="line"><span class="function"><span class="keyword">int</span> <span class="title">main</span><span class="params">()</span></span>&#123;</span><br><span class="line">	freopen(<span class="string">&quot;gymnastics.in&quot;</span>,<span class="string">&quot;r&quot;</span>,<span class="built_in">stdin</span>);</span><br><span class="line">	freopen(<span class="string">&quot;gymnastics.out&quot;</span>,<span class="string">&quot;w&quot;</span>,<span class="built_in">stdout</span>);</span><br><span class="line">	<span class="built_in">cin</span>&gt;&gt;k&gt;&gt;n;</span><br><span class="line">	<span class="keyword">int</span> p;</span><br><span class="line">	<span class="keyword">for</span>(<span class="keyword">int</span> i=<span class="number">1</span>;i&lt;=k;i++)&#123;</span><br><span class="line">		<span class="keyword">for</span>(<span class="keyword">int</span> j=<span class="number">1</span>;j&lt;=n;j++)&#123;</span><br><span class="line">			<span class="built_in">cin</span>&gt;&gt;p;</span><br><span class="line">			a[p][i]=j;</span><br><span class="line">		&#125;</span><br><span class="line">	&#125;</span><br><span class="line">	<span class="keyword">bool</span> book=<span class="literal">false</span>;</span><br><span class="line">	<span class="keyword">for</span>(<span class="keyword">int</span> i=<span class="number">1</span>;i&lt;=n;i++)&#123;</span><br><span class="line">		<span class="keyword">for</span>(<span class="keyword">int</span> j=<span class="number">1</span>;j&lt;=n;j++)&#123;</span><br><span class="line">			book=<span class="literal">true</span>;</span><br><span class="line">			<span class="keyword">if</span>(j==i) <span class="keyword">continue</span>;</span><br><span class="line">			<span class="keyword">for</span>(<span class="keyword">int</span> w=<span class="number">1</span>;w&lt;=k;w++)&#123;</span><br><span class="line">				<span class="keyword">if</span>(a[i][w]&gt;a[j][w])&#123;</span><br><span class="line">					book=<span class="literal">false</span>;</span><br><span class="line">					<span class="keyword">break</span>;</span><br><span class="line">				&#125;</span><br><span class="line">			&#125;</span><br><span class="line">			<span class="keyword">if</span>(book)&#123;</span><br><span class="line">				ans++;</span><br><span class="line">			&#125;</span><br><span class="line">		&#125;</span><br><span class="line">	&#125;</span><br><span class="line">	<span class="built_in">cout</span>&lt;&lt;ans&lt;&lt;<span class="built_in">endl</span>;</span><br><span class="line">	fclose(<span class="built_in">stdin</span>);</span><br><span class="line">	fclose(<span class="built_in">stdout</span>);</span><br><span class="line">	<span class="keyword">return</span> <span class="number">0</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br></pre></td></tr></table></figure>
<hr>
<h3 id="第二题："><a href="#第二题：" class="headerlink" title="第二题："></a><strong>第二题：</strong></h3><p><a target="_blank" rel="noopener" href="http://usaco.org/index.php?page=viewproblem2&amp;cpid=964">Where Am I?</a></p>
<p><strong>题目：</strong></p>
<p>Farmer John has gone out for a walk down the road and thinks he may now be lost!<br>Along the road there are N farms (1≤N≤100) in a row. Farms unfortunately do not have house numbers, making it hard for Farmer John to figure out his location along the road. However, each farm does have a colorful mailbox along the side of the road, so Farmer John hopes that if he looks at the colors of the mailboxes nearest to him, he can uniquely determine where he is.</p>
<p>Each mailbox color is specified by a letter in the range A..Z, so the sequence of N mailboxes down the road can be represented by a string of length N containing letters in the range A..Z. Some mailboxes may have the same colors as other mailboxes. Farmer John wants to know what is the smallest value of K such that if he looks at any sequence of K consecutive mailboxes, he can uniquely determine the location of that sequence along the road.</p>
<p>For example, suppose the sequence of mailboxes along the road is ‘ABCDABC’. Farmer John cannot set K=3, since if he sees ‘ABC’, there are two possible locations along the road where this consecutive set of colors might be. The smallest value of K that works is K=4, since if he looks at any consecutive set of 4 mailboxes, this sequence of colors uniquely determines his position along the road.</p>
<p><strong>翻译：</strong></p>
<p>Farmer John 出门沿着马路散步，但是他现在发现可能迷路了！<br>沿路有一排共 N 个农场（1≤N≤100）。不幸的是农场并没有编号，这使得 Farmer John 难以分辨他在这条路上所处的位置。然而，每个农场都沿路设有一个彩色的邮箱，所以 Farmer John 希望能够通过查看最近的几个邮箱的颜色来唯一确定他所在的位置。</p>
<p>每个邮箱的颜色用 A..Z 之间的一个字母来指定，所以沿着道路的 N 个邮箱的序列可以用一个长为 N 的由字母 A..Z 组成的字符串来表示。某些邮箱可能会有相同的颜色。Farmer John 想要知道最小的 K 的值，使得他查看任意连续 K 个邮箱序列，他都可以唯一确定这一序列在道路上的位置。</p>
<p>例如，假设沿路的邮箱序列为 ‘ABCDABC’ 。Farmer John 不能令 K=3，因为如果他看到了 ‘ABC’，沿路有两个这一连续颜色序列可能所在的位置。最小可行的 K 的值为 K=4，因为如果他查看任意连续 4 个邮箱，这一颜色序列可以唯一确定他在道路上的位置。</p>
<p><strong>输入格式（文件名：whereami.in）：</strong></p>
<p>输入的第一行包含 N，第二行包含一个由 N 个字符组成的字符串，每个字符均在 A..Z 之内。</p>
<p><strong>输出格式（文件名：whereami.out）：</strong></p>
<p>输出一行，包含一个整数，为可以解决 Farmer John 的问题的最小 K 值。</p>
<p><strong>输入样例：</strong></p>
<p>7<br>ABCDABC</p>
<p><strong>输出样例：</strong></p>
<p>4</p>
<p><strong>代码：</strong></p>
<figure class="highlight cpp"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/*</span></span><br><span class="line"><span class="comment">ID: zhaojiayi</span></span><br><span class="line"><span class="comment">TASK: Where Am I?</span></span><br><span class="line"><span class="comment">LANG: C++</span></span><br><span class="line"><span class="comment">*/</span></span><br><span class="line"><span class="meta">#<span class="meta-keyword">include</span><span class="meta-string">&lt;bits/stdc++.h&gt;</span></span></span><br><span class="line"><span class="keyword">using</span> <span class="keyword">namespace</span> <span class="built_in">std</span>;</span><br><span class="line"><span class="keyword">int</span> n;</span><br><span class="line"><span class="built_in">string</span> s;</span><br><span class="line"><span class="keyword">int</span> ans=<span class="number">1</span>;</span><br><span class="line"><span class="function"><span class="keyword">int</span> <span class="title">main</span><span class="params">()</span></span>&#123;</span><br><span class="line">	freopen(<span class="string">&quot;whereami.in&quot;</span>,<span class="string">&quot;r&quot;</span>,<span class="built_in">stdin</span>);</span><br><span class="line">	freopen(<span class="string">&quot;whereami.out&quot;</span>,<span class="string">&quot;w&quot;</span>,<span class="built_in">stdout</span>);</span><br><span class="line">	<span class="built_in">cin</span>&gt;&gt;n;</span><br><span class="line">	<span class="built_in">cin</span>&gt;&gt;s;</span><br><span class="line">	<span class="keyword">int</span> len=s.size();</span><br><span class="line">	<span class="keyword">for</span>(<span class="keyword">int</span> i=<span class="number">0</span>;i&lt;len;i++)&#123;</span><br><span class="line">		<span class="keyword">for</span>(<span class="keyword">int</span> j=i+<span class="number">1</span>;j&lt;len;j++)&#123;</span><br><span class="line">			<span class="keyword">int</span> cnt=<span class="number">1</span>;</span><br><span class="line">			<span class="keyword">bool</span> b=<span class="literal">false</span>;</span><br><span class="line">			<span class="keyword">while</span>(s[i]==s[j])&#123;</span><br><span class="line">				b=<span class="literal">true</span>;</span><br><span class="line">				i++;</span><br><span class="line">				j++;</span><br><span class="line">				cnt++;</span><br><span class="line">			&#125;</span><br><span class="line">			<span class="keyword">if</span>(b)&#123;</span><br><span class="line">				i-=<span class="number">1</span>;</span><br><span class="line">				j-=<span class="number">1</span>;</span><br><span class="line">			&#125;</span><br><span class="line">			ans=max(ans,cnt);</span><br><span class="line">		&#125;</span><br><span class="line">	&#125;</span><br><span class="line">	<span class="built_in">cout</span>&lt;&lt;ans;</span><br><span class="line">	fclose(<span class="built_in">stdin</span>);</span><br><span class="line">	fclose(<span class="built_in">stdout</span>);</span><br><span class="line">	<span class="keyword">return</span> <span class="number">0</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br></pre></td></tr></table></figure>
<hr>
<h3 id="第三题："><a href="#第三题：" class="headerlink" title="第三题："></a><strong>第三题：</strong></h3><p><a target="_blank" rel="noopener" href="http://usaco.org/index.php?page=viewproblem2&amp;cpid=965">Livestock Lineup</a></p>
<p><strong>题目：</strong></p>
<p>Every day, Farmer John milks his 8 dairy cows, named Bessie, Buttercup, Belinda, Beatrice, Bella, Blue, Betsy, and Sue.<br>The cows are rather picky, unfortunately, and require that Farmer John milks them in an order that respects N constraints (1≤N≤7). Each constraint is of the form “X must be milked beside Y”, stipulating that cow X must appear in the milking order either directly after cow Y or directly before cow Y.</p>
<p>Please help Farmer John determine an ordering of his cows that satisfies all of these required constraints. It is guaranteed that an ordering is always possible. If several orderings work, then please output the one that is alphabetically first. That is, the first cow should have the alphabetically lowest name of all possible cows that could appear first in any valid ordering. Among all orderings starting with this same alphabetically-first cow, the second cow should be alphabetically lowest among all possible valid orderings, and so on.</p>
<p><strong>翻译：</strong></p>
<p>每天，Farmer John 都要给他的 8 头奶牛挤奶。她们的名字分别是 Bessie，Buttercup，Belinda，Beatrice，Bella，Blue，Betsy，和 Sue。<br>不幸的是，这些奶牛相当难以伺候，她们要求 Farmer John 以一种符合 N 条限制的顺序给她们挤奶（1≤N≤7）。每条限制的形式为“X 必须紧邻着 Y 挤奶”，要求奶牛 X 在挤奶顺序中必须紧接在奶牛 Y 之后，或者紧接在奶牛 Y 之前。</p>
<p>请帮助 Farmer John 求出一种满足所有限制的奶牛挤奶顺序。保证这样的顺序是存在的。如果有多种顺序都满足要求，请输出字典序最小的一种。也就是说，第一头奶牛需要是所有可能排在任意合法奶牛顺序的第一位的奶牛中名字字典序最小的。在所有合法的以这头字典序最小的奶牛为首的奶牛顺序中，第二头奶牛需要是字典序最小的，以此类推。</p>
<p><strong>输入格式（文件名：lineup.in）：</strong></p>
<p>输入的第一行包含 N。以下 N 行每行包含一句句子，以 “X must be milked beside Y” 的格式描述了一条限制，其中 X 和 Y 为 Farmer John 的某些奶牛的名字（上文列举了八个可能的名字）。</p>
<p><strong>输出格式（文件名：lineup.out）：</strong></p>
<p>请用 8 行输出一个奶牛的顺序，每行输出一头奶牛的名字，满足所有的限制。如果由多种顺序符合要求，输出字典序最小的奶牛顺序。</p>
<p><strong>输入样例：</strong></p>
<p>3<br>Buttercup must be milked beside Bella<br>Blue must be milked beside Bella<br>Sue must be milked beside Beatrice  </p>
<p><strong>输出样例：</strong></p>
<p>Beatrice<br>Sue<br>Belinda<br>Bessie<br>Betsy<br>Blue<br>Bella<br>Buttercup  </p>
<p><strong>代码</strong> <em>(20分)</em> <strong>：</strong></p>
<figure class="highlight cpp"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/*</span></span><br><span class="line"><span class="comment">ID: zhaojiayi</span></span><br><span class="line"><span class="comment">TASK: Livestock Lineup</span></span><br><span class="line"><span class="comment">LANG: C++</span></span><br><span class="line"><span class="comment">*/</span></span><br><span class="line"><span class="comment">//Bessie=1,Buttercup=2,Belinda=3,Beatrice=4,Bella=5,Blue=6,Betsy=7,Sue=8</span></span><br><span class="line"><span class="meta">#<span class="meta-keyword">include</span><span class="meta-string">&lt;bits/stdc++.h&gt;</span></span></span><br><span class="line"><span class="keyword">using</span> <span class="keyword">namespace</span> <span class="built_in">std</span>;</span><br><span class="line"><span class="keyword">int</span> n;</span><br><span class="line"><span class="built_in">string</span> s[<span class="number">10</span>];</span><br><span class="line"><span class="keyword">int</span> a[<span class="number">10</span>][<span class="number">2</span>];</span><br><span class="line"><span class="keyword">bool</span> book[<span class="number">10</span>];</span><br><span class="line"><span class="keyword">int</span> ans[<span class="number">10</span>];</span><br><span class="line"><span class="keyword">bool</span> killer=<span class="literal">false</span>;</span><br><span class="line"><span class="function"><span class="keyword">bool</span> <span class="title">check</span><span class="params">()</span></span>&#123;</span><br><span class="line">	<span class="keyword">for</span>(<span class="keyword">int</span> i=<span class="number">1</span>;i&lt;=<span class="number">8</span>;i++)&#123;</span><br><span class="line">		<span class="keyword">if</span>(a[ans[i]][<span class="number">0</span>]!=<span class="number">0</span>)&#123;</span><br><span class="line">			<span class="keyword">if</span>(a[ans[i]][<span class="number">0</span>]!=ans[i<span class="number">-1</span>]&amp;&amp;a[ans[i]][<span class="number">0</span>]!=ans[i+<span class="number">1</span>]) <span class="keyword">return</span> <span class="literal">false</span>;</span><br><span class="line">			<span class="keyword">else</span> <span class="keyword">if</span>(a[ans[i]][<span class="number">1</span>]!=<span class="number">0</span>)&#123;</span><br><span class="line">				<span class="keyword">if</span>(a[ans[i]][<span class="number">1</span>]!=ans[i<span class="number">-1</span>]&amp;&amp;a[ans[i]][<span class="number">1</span>]!=ans[i+<span class="number">1</span>]) <span class="keyword">return</span> <span class="literal">false</span>;</span><br><span class="line">			&#125;</span><br><span class="line">		&#125;</span><br><span class="line">	&#125;</span><br><span class="line">	<span class="keyword">return</span> <span class="literal">true</span>;</span><br><span class="line">&#125;</span><br><span class="line"><span class="function"><span class="keyword">void</span> <span class="title">f</span><span class="params">(<span class="keyword">int</span> step)</span></span>&#123;</span><br><span class="line">	<span class="keyword">if</span>(killer) <span class="keyword">return</span>;</span><br><span class="line">	<span class="keyword">if</span>(step&gt;=<span class="number">8</span>)&#123;</span><br><span class="line">		<span class="comment">//cout&lt;&lt;11111111111;</span></span><br><span class="line">		<span class="keyword">if</span>(check())&#123;</span><br><span class="line">			</span><br><span class="line">			<span class="keyword">for</span>(<span class="keyword">int</span> i=<span class="number">1</span>;i&lt;=<span class="number">8</span>;i++)&#123;</span><br><span class="line">				</span><br><span class="line">				<span class="keyword">if</span>(i==<span class="number">4</span>) <span class="built_in">cout</span>&lt;&lt;<span class="string">&quot;Bessie&quot;</span>&lt;&lt;<span class="built_in">endl</span>;</span><br><span class="line">				<span class="keyword">else</span> <span class="keyword">if</span>(ans[i]==<span class="number">7</span>) <span class="built_in">cout</span>&lt;&lt;<span class="string">&quot;Buttercup&quot;</span>&lt;&lt;<span class="built_in">endl</span>;</span><br><span class="line">				<span class="keyword">else</span> <span class="keyword">if</span>(ans[i]==<span class="number">2</span>) <span class="built_in">cout</span>&lt;&lt;<span class="string">&quot;Belinda&quot;</span>&lt;&lt;<span class="built_in">endl</span>;</span><br><span class="line">				<span class="keyword">else</span> <span class="keyword">if</span>(ans[i]==<span class="number">1</span>) <span class="built_in">cout</span>&lt;&lt;<span class="string">&quot;Beatrice&quot;</span>&lt;&lt;<span class="built_in">endl</span>;</span><br><span class="line">				<span class="keyword">else</span> <span class="keyword">if</span>(ans[i]==<span class="number">3</span>) <span class="built_in">cout</span>&lt;&lt;<span class="string">&quot;Bella&quot;</span>&lt;&lt;<span class="built_in">endl</span>;</span><br><span class="line">				<span class="keyword">else</span> <span class="keyword">if</span>(ans[i]==<span class="number">6</span>) <span class="built_in">cout</span>&lt;&lt;<span class="string">&quot;Blue&quot;</span>&lt;&lt;<span class="built_in">endl</span>;</span><br><span class="line">				<span class="keyword">else</span> <span class="keyword">if</span>(ans[i]==<span class="number">5</span>) <span class="built_in">cout</span>&lt;&lt;<span class="string">&quot;Betsy&quot;</span>&lt;&lt;<span class="built_in">endl</span>;</span><br><span class="line">				<span class="keyword">else</span> <span class="keyword">if</span>(ans[i]==<span class="number">8</span>) <span class="built_in">cout</span>&lt;&lt;<span class="string">&quot;Sue&quot;</span>&lt;&lt;<span class="built_in">endl</span>;</span><br><span class="line">				</span><br><span class="line">				<span class="comment">//cout&lt;&lt;ans[i]&lt;&lt;&quot; &quot;;</span></span><br><span class="line">			&#125;</span><br><span class="line">			<span class="comment">//cout&lt;&lt;endl;</span></span><br><span class="line">			killer=<span class="literal">true</span>;</span><br><span class="line">		&#125;</span><br><span class="line">		<span class="keyword">return</span>;</span><br><span class="line">	&#125;</span><br><span class="line">	<span class="keyword">for</span>(<span class="keyword">int</span> i=<span class="number">1</span>;i&lt;=<span class="number">8</span>;i++)&#123;</span><br><span class="line">		<span class="keyword">if</span>(!book[i])&#123;</span><br><span class="line">			book[i]=<span class="literal">true</span>;</span><br><span class="line">			ans[step+<span class="number">1</span>]=i;</span><br><span class="line">			f(step+<span class="number">1</span>);</span><br><span class="line">			book[i]=<span class="literal">false</span>;</span><br><span class="line">		&#125;</span><br><span class="line">	&#125;</span><br><span class="line">&#125;</span><br><span class="line"><span class="built_in">string</span> p;</span><br><span class="line"><span class="function"><span class="keyword">int</span> <span class="title">main</span><span class="params">()</span></span>&#123;</span><br><span class="line">	freopen(<span class="string">&quot;lineup.in&quot;</span>,<span class="string">&quot;r&quot;</span>,<span class="built_in">stdin</span>);</span><br><span class="line">	freopen(<span class="string">&quot;lineup.out&quot;</span>,<span class="string">&quot;w&quot;</span>,<span class="built_in">stdout</span>);</span><br><span class="line">	<span class="built_in">cin</span>&gt;&gt;n;</span><br><span class="line">	<span class="keyword">for</span>(<span class="keyword">int</span> i=<span class="number">0</span>;i&lt;n;i++)&#123;</span><br><span class="line">		<span class="built_in">cin</span>&gt;&gt;p;</span><br><span class="line">		<span class="comment">//cout&lt;&lt;p&lt;&lt;&quot; &quot;;</span></span><br><span class="line">		<span class="keyword">int</span> num1=<span class="number">0</span>;</span><br><span class="line">		<span class="keyword">int</span> num2=<span class="number">0</span>;</span><br><span class="line">		<span class="keyword">if</span>(p[<span class="number">2</span>]==<span class="string">&#x27;s&#x27;</span>&amp;&amp;p[<span class="number">3</span>]==<span class="string">&#x27;s&#x27;</span>) num1=<span class="number">4</span>;</span><br><span class="line">		<span class="keyword">else</span> <span class="keyword">if</span>(p[<span class="number">2</span>]==<span class="string">&#x27;t&#x27;</span>&amp;&amp;p[<span class="number">3</span>]==<span class="string">&#x27;t&#x27;</span>) num1=<span class="number">7</span>;</span><br><span class="line">		<span class="keyword">else</span> <span class="keyword">if</span>(p[<span class="number">2</span>]==<span class="string">&#x27;l&#x27;</span>&amp;&amp;p[<span class="number">3</span>]==<span class="string">&#x27;i&#x27;</span>) num1=<span class="number">2</span>;</span><br><span class="line">		<span class="keyword">else</span> <span class="keyword">if</span>(p[<span class="number">2</span>]==<span class="string">&#x27;a&#x27;</span>&amp;&amp;p[<span class="number">3</span>]==<span class="string">&#x27;t&#x27;</span>) num1=<span class="number">1</span>;</span><br><span class="line">		<span class="keyword">else</span> <span class="keyword">if</span>(p[<span class="number">2</span>]==<span class="string">&#x27;l&#x27;</span>&amp;&amp;p[<span class="number">3</span>]==<span class="string">&#x27;l&#x27;</span>) num1=<span class="number">3</span>;</span><br><span class="line">		<span class="keyword">else</span> <span class="keyword">if</span>(p[<span class="number">2</span>]==<span class="string">&#x27;u&#x27;</span>&amp;&amp;p[<span class="number">3</span>]==<span class="string">&#x27;e&#x27;</span>) num1=<span class="number">6</span>;</span><br><span class="line">		<span class="keyword">else</span> <span class="keyword">if</span>(p[<span class="number">2</span>]==<span class="string">&#x27;t&#x27;</span>&amp;&amp;p[<span class="number">3</span>]==<span class="string">&#x27;s&#x27;</span>) num1=<span class="number">5</span>;</span><br><span class="line">		<span class="keyword">else</span> num1=<span class="number">8</span>;</span><br><span class="line">		<span class="built_in">cin</span>&gt;&gt;p;</span><br><span class="line">		<span class="built_in">cin</span>&gt;&gt;p;</span><br><span class="line">		<span class="built_in">cin</span>&gt;&gt;p;</span><br><span class="line">		<span class="built_in">cin</span>&gt;&gt;p;</span><br><span class="line">		<span class="built_in">cin</span>&gt;&gt;s[i];</span><br><span class="line">		<span class="keyword">int</span> len=s[i].size();</span><br><span class="line">		<span class="comment">//Bessie=1,Buttercup=2,Belinda=3,Beatrice=4,Bella=5,Blue=6,Betsy=7,Sue=8</span></span><br><span class="line">		<span class="comment">//Bessie=4,Buttercup=7,Belinda=2,Beatrice=1,Bella=3,Blue=6,Betsy=5,Sue=8</span></span><br><span class="line">		<span class="keyword">if</span>(s[i][len<span class="number">-1</span>]==<span class="string">&#x27;e&#x27;</span>&amp;&amp;s[i][len<span class="number">-2</span>]==<span class="string">&#x27;i&#x27;</span>)num2=<span class="number">4</span>;</span><br><span class="line">		<span class="keyword">else</span> <span class="keyword">if</span>(s[i][len<span class="number">-1</span>]==<span class="string">&#x27;p&#x27;</span>&amp;&amp;s[i][len<span class="number">-2</span>]==<span class="string">&#x27;u&#x27;</span>)num2=<span class="number">7</span>;</span><br><span class="line">		<span class="keyword">else</span> <span class="keyword">if</span>(s[i][len<span class="number">-1</span>]==<span class="string">&#x27;a&#x27;</span>&amp;&amp;s[i][len<span class="number">-2</span>]==<span class="string">&#x27;d&#x27;</span>)num2=<span class="number">2</span>;</span><br><span class="line">		<span class="keyword">else</span> <span class="keyword">if</span>(s[i][len<span class="number">-1</span>]==<span class="string">&#x27;e&#x27;</span>&amp;&amp;s[i][len<span class="number">-2</span>]==<span class="string">&#x27;c&#x27;</span>)num2=<span class="number">1</span>;</span><br><span class="line">		<span class="keyword">else</span> <span class="keyword">if</span>(s[i][len<span class="number">-1</span>]==<span class="string">&#x27;a&#x27;</span>&amp;&amp;s[i][len<span class="number">-2</span>]==<span class="string">&#x27;l&#x27;</span>)num2=<span class="number">3</span>;</span><br><span class="line">		<span class="keyword">else</span> <span class="keyword">if</span>(s[i][len<span class="number">-1</span>]==<span class="string">&#x27;e&#x27;</span>&amp;&amp;s[i][len<span class="number">-2</span>]==<span class="string">&#x27;u&#x27;</span>&amp;&amp;s[i][len<span class="number">-3</span>]==<span class="string">&#x27;l&#x27;</span>)num2=<span class="number">6</span>;</span><br><span class="line">		<span class="keyword">else</span> <span class="keyword">if</span>(s[i][len<span class="number">-1</span>]==<span class="string">&#x27;y&#x27;</span>&amp;&amp;s[i][len<span class="number">-2</span>]==<span class="string">&#x27;s&#x27;</span>)num2=<span class="number">5</span>;</span><br><span class="line">		<span class="keyword">else</span> <span class="keyword">if</span>(s[i][len<span class="number">-1</span>]==<span class="string">&#x27;e&#x27;</span>&amp;&amp;s[i][len<span class="number">-2</span>]==<span class="string">&#x27;u&#x27;</span>&amp;&amp;s[i][len<span class="number">-3</span>]==<span class="string">&#x27;S&#x27;</span>)num2=<span class="number">8</span>;</span><br><span class="line">		<span class="keyword">if</span>(a[num1][<span class="number">0</span>]==<span class="number">0</span>) a[num1][<span class="number">0</span>]=num2;</span><br><span class="line">		<span class="keyword">else</span> a[num1][<span class="number">1</span>]=num2;</span><br><span class="line">		<span class="keyword">if</span>(a[num2][<span class="number">0</span>]==<span class="number">0</span>) a[num2][<span class="number">0</span>]=num1;</span><br><span class="line">		<span class="keyword">else</span> a[num2][<span class="number">1</span>]=num1;</span><br><span class="line">	&#125;</span><br><span class="line">	<span class="comment">//cout&lt;&lt;a[8][1]&lt;&lt;endl;</span></span><br><span class="line">	<span class="keyword">for</span>(<span class="keyword">int</span> i=<span class="number">1</span>;i&lt;=<span class="number">8</span>;i++)&#123;</span><br><span class="line">		<span class="keyword">if</span>(killer)&#123;</span><br><span class="line">			<span class="keyword">return</span> <span class="number">0</span>;</span><br><span class="line">		&#125;</span><br><span class="line">		<span class="built_in">memset</span>(book,<span class="number">0</span>,<span class="keyword">sizeof</span>(book));</span><br><span class="line">		<span class="built_in">memset</span>(ans,<span class="number">0</span>,<span class="keyword">sizeof</span>(ans));</span><br><span class="line">		book[i]=<span class="literal">true</span>;</span><br><span class="line">		ans[<span class="number">1</span>]=i;</span><br><span class="line">		f(<span class="number">1</span>);</span><br><span class="line">	&#125;</span><br><span class="line">	<span class="keyword">return</span> <span class="number">0</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br></pre></td></tr></table></figure>

    </div>

    
    
    

      <footer class="post-footer">
          <div class="post-tags">
              <a href="/tags/%E4%BF%A1%E6%81%AF%E5%AD%A6/" rel="tag"># 信息学</a>
          </div>

        


        
    <div class="post-nav">
      <div class="post-nav-item">
    <a href="/2019/05/31/%E4%BB%95%E9%9A%90%E9%A3%8E%E4%BA%91%E8%B0%B1/" rel="prev" title="仕隐风云谱">
      <i class="fa fa-chevron-left"></i> 仕隐风云谱
    </a></div>
      <div class="post-nav-item">
    <a href="/2020/04/20/%E8%83%8C%E5%8C%85%E9%97%AE%E9%A2%98/" rel="next" title="背包问题">
      背包问题 <i class="fa fa-chevron-right"></i>
    </a></div>
    </div>
      </footer>
    
  </article>
  
  
  



          </div>
          
    <div class="comments" id="valine-comments"></div>

<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      let commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
          <div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-3"><a class="nav-link" href="#%E6%AF%94%E8%B5%9B%E9%93%BE%E6%8E%A5"><span class="nav-text">比赛链接</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E7%AC%AC%E4%B8%80%E9%A2%98%EF%BC%9A"><span class="nav-text">第一题：</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E7%AC%AC%E4%BA%8C%E9%A2%98%EF%BC%9A"><span class="nav-text">第二题：</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E7%AC%AC%E4%B8%89%E9%A2%98%EF%BC%9A"><span class="nav-text">第三题：</span></a></li></ol></div>
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="Zhao Jiayi"
      src="/images/doggy.jpg">
  <p class="site-author-name" itemprop="name">Zhao Jiayi</p>
  <div class="site-description" itemprop="description"></div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/archives/">
        
          <span class="site-state-item-count">10</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/categories/">
          
        <span class="site-state-item-count">4</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/tags/">
          
        <span class="site-state-item-count">7</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>
  <div class="links-of-author motion-element">
      <span class="links-of-author-item">
        <a href="mailto:1423035286@qq.com" title="E-Mail → mailto:1423035286@qq.com" rel="noopener" target="_blank"><i class="fa fa-envelope fa-fw"></i>E-Mail</a>
      </span>
      <span class="links-of-author-item">
        <a href="/1423035286" title="QQ → 1423035286"><i class="fab fa-qq fa-fw"></i>QQ</a>
      </span>
  </div>


  <div class="links-of-blogroll motion-element">
    <div class="links-of-blogroll-title"><i class="fa fa-link fa-fw"></i>
      链接
    </div>
    <ul class="links-of-blogroll-list">
        <li class="links-of-blogroll-item">
          <a href="http://140.143.166.224/" title="http:&#x2F;&#x2F;140.143.166.224&#x2F;" rel="noopener" target="_blank">BJEAOJ</a>
        </li>
        <li class="links-of-blogroll-item">
          <a href="http://124.205.120.153/" title="http:&#x2F;&#x2F;124.205.120.153&#x2F;" rel="noopener" target="_blank">BNDSOJ</a>
        </li>
        <li class="links-of-blogroll-item">
          <a href="https://www.luogu.com.cn/" title="https:&#x2F;&#x2F;www.luogu.com.cn&#x2F;" rel="noopener" target="_blank">洛谷</a>
        </li>
        <li class="links-of-blogroll-item">
          <a href="https://masonwang5914.github.io/" title="https:&#x2F;&#x2F;masonwang5914.github.io&#x2F;" rel="noopener" target="_blank">浩宇老师博客</a>
        </li>
    </ul>
  </div>

      </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

        

<div class="copyright">
  
  &copy; 
  <span itemprop="copyrightYear">2020</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Zhao Jiayi</span>
</div>

<div>
<script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
<span id="busuanzi_container_site_pv" style='display:none'>
    本站总访问量 <span id="busuanzi_value_site_pv"></span> 次
    <span class="post-meta-divider">|</span>
</span>
<span id="busuanzi_container_site_uv" style='display:none'>
    有<span id="busuanzi_value_site_uv"></span>人看过我的博客
</span>
</div>

        








      </div>
    </footer>
  </div>

  
  <script src="/lib/anime.min.js"></script>
  <script src="/lib/velocity/velocity.min.js"></script>
  <script src="/lib/velocity/velocity.ui.min.js"></script>

<script src="/js/utils.js"></script>

<script src="/js/motion.js"></script>


<script src="/js/schemes/pisces.js"></script>


<script src="/js/next-boot.js"></script>




  
  <script>
    (function(){
      var canonicalURL, curProtocol;
      //Get the <link> tag
      var x=document.getElementsByTagName("link");
		//Find the last canonical URL
		if(x.length > 0){
			for (i=0;i<x.length;i++){
				if(x[i].rel.toLowerCase() == 'canonical' && x[i].href){
					canonicalURL=x[i].href;
				}
			}
		}
    //Get protocol
	    if (!canonicalURL){
	    	curProtocol = window.location.protocol.split(':')[0];
	    }
	    else{
	    	curProtocol = canonicalURL.split(':')[0];
	    }
      //Get current URL if the canonical URL does not exist
	    if (!canonicalURL) canonicalURL = window.location.href;
	    //Assign script content. Replace current URL with the canonical URL
      !function(){var e=/([http|https]:\/\/[a-zA-Z0-9\_\.]+\.baidu\.com)/gi,r=canonicalURL,t=document.referrer;if(!e.test(r)){var n=(String(curProtocol).toLowerCase() === 'https')?"https://sp0.baidu.com/9_Q4simg2RQJ8t7jm9iCKT-xh_/s.gif":"//api.share.baidu.com/s.gif";t?(n+="?r="+encodeURIComponent(document.referrer),r&&(n+="&l="+r)):r&&(n+="?l="+r);var i=new Image;i.src=n}}(window);})();
  </script>




  
<script src="/js/local-search.js"></script>













  

  

  


<script>
NexT.utils.loadComments(document.querySelector('#valine-comments'), () => {
  NexT.utils.getScript('//unpkg.com/valine/dist/Valine.min.js', () => {
    var GUEST = ['nick', 'mail', 'link'];
    var guest = 'nick,mail,link';
    guest = guest.split(',').filter(item => {
      return GUEST.includes(item);
    });
    new Valine({
      el         : '#valine-comments',
      verify     : false,
      notify     : false,
      appId      : 'egbHdezmbhNkGI8udEdOmtxs-gzGzoHsz',
      appKey     : 'ImiKQHShq5rs7Sy6krOc6mDo',
      placeholder: "快来评论吧~",
      avatar     : 'mm',
      meta       : guest,
      pageSize   : '10' || 10,
      visitor    : false,
      lang       : '' || 'zh-cn',
      path       : location.pathname,
      recordIP   : false,
      serverURLs : ''
    });
  }, window.Valine);
});
</script><!-- hexo-inject:begin --><!-- hexo-inject:end -->

</body>
</html>
